| Conditions | 1 |
| Total Lines | 19 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { CommandHandler } from '@nestjs/cqrs'; |
||
| 20 | |||
| 21 | public async execute(command: CreateEventCommand): Promise<string> { |
||
| 22 | const { date, summary, userId, schoolId } = command; |
||
| 23 | |||
| 24 | const [ user, school ] = await Promise.all([ |
||
| 25 | this.getUser(userId), |
||
| 26 | this.getSchool(schoolId) |
||
| 27 | ]); |
||
| 28 | |||
| 29 | const event = await this.eventRepository.save( |
||
| 30 | new Event( |
||
| 31 | date, |
||
| 32 | user, |
||
| 33 | school, |
||
| 34 | summary |
||
| 35 | ) |
||
| 36 | ); |
||
| 37 | |||
| 38 | return event.getId(); |
||
| 39 | } |
||
| 41 |